from django.template import Library
from django.urls import reverse, resolve  # py中反向解析url地址

from web import models

register = Library()


@register.simple_tag
def string_just(num):
    """ 改页面展示样式 """
    if num < 100 and num > 10:
        # str_num = str(num)
        # str_num.rjust(3, '0')  # 字符x位数不够 y补足
        # # print("123".rjust(16, "0"))
        # print(str_num, type(str_num))
        num = f'0{num}'
    elif num < 10:
        num = f'00{num}'
    return f'#{num}'
